/**
* All Rights Reserved , Copyright (C) 2022 , 青岛鼎信通讯股份有限公司
*
* MpmProjectNoMeetWeekService
* 销售项目不开周会配置表
*
* 修改纪录
* 2022-12-15 版本：1.0 houyuhang 创建。
* @version 版本：1.0
* @author 作者：houyuhang
* 创建日期：2022-12-15
*/
package com.topscomm.mpm.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.topscomm.basic.BasicEntity;
import com.topscomm.basic.exception.ServiceException;
import com.topscomm.mpm.pojo.MpmProjectNoMeetWeekEntity;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.topscomm.mpm.service.IMpmProjectNoMeetWeekService;
import com.topscomm.mpm.service.impl.auto.MpmProjectNoMeetWeekServiceAuto;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service(value = "mpmProjectNoMeetWeekService")
@Scope(value = "singleton")
public class MpmProjectNoMeetWeekService extends MpmProjectNoMeetWeekServiceAuto implements IMpmProjectNoMeetWeekService {
    /**
     * @author: houyuhang
     * @date: 2022-12-15
     * @description:保存不统计周会周次
     * @modify:
     */
    @Transactional
    public void saveNoMeetWeek(Map<String, Object> paraMap) {
        List<Map<String, Object>> weekList = (List<Map<String, Object>>) paraMap.get("weeklist");
        // 删除之前的不统计周会信息，再新增不统计周会信息
        this.deleteByWhere(" enabled = 1 ");
        List<BasicEntity> basicEntities = new ArrayList<>();
        for (Map<String, Object> weekMap : weekList) {
            MpmProjectNoMeetWeekEntity entity = new MpmProjectNoMeetWeekEntity();
            entity.convertFromMap(weekMap);
            basicEntities.add(entity);
        }
        this.insertBatch(basicEntities);
    }
}
